<template>
  <div class="layoutSidebar">
    <div class="layoutSidebar_hd">
      <span class="layoutSidebar_hd_title">物资需求与分布</span>
    </div>
    <div class="layoutSidebar_bd">
      <!-- <Autocomplete @selAddress="selAddress"></Autocomplete> -->
      <AreaTree
        class="layoutSidebar_bd_tree"
        :isShowSearch="true"
        @nodeClick="treeNnodeClick"
      ></AreaTree>
    </div>
  </div>
</template>
<script lang="ts">
import { Component, Vue, Prop } from "vue-property-decorator";
import Autocomplete from "@/components/common/Autocomplete.vue";
import AreaTree from "@/components/common/AreaTree.vue";
import MapCommon from "@/util/MapCommon";
@Component({
  name: "WzxqyfbSidebar",
  components: {
    Autocomplete,
    AreaTree
  },
  mixins: [MapCommon] // GIS 将地图解析方法混入当前组件
})
export default class WzxqyfbSidebar extends Vue {
  private MapComp: any = null;

  private popData: any = null;
  private isShowPop: any = false;

  // private selAddress(data: any) {
  //   this.getComponent().panTo(data.level, data.location);
  // }

  private treeNnodeClick(data: any, checked: any, indeterminate: any) {
    this.messsageBus.emit("wzxqyfbSidebar", checked.data);
    this.getComponent().panTo(data.level, data.location);
  }

  // private getComponent() {
  //   const modules = (this as any).$ioc.resolve('GISModules-map');
  //   const component = modules.eventSituation.getComponent('material');
  //   debugger
  //   return component;
  // }

  private getComponent() {
    const self: any = this;
    const modules = self.$ioc.resolve("GISModules-map");
    const component = modules.eventSituation.getComponent("material");
    return component;
  }

  private mounted() {
    (this as any).resolveMap("map").then(() => {
      this.MapComp = this.getComponent();

      this.$store.dispatch("WzxqyfbModule/wzxqyfbMapEmit", this.MapComp);
      // this.MapComp.on('popup', this.onPuppup, this);
      // this.MapComp.load();
    });
  }
}
</script>
<style lang="less" scoped>
@import url("../../../assets/css/LayoutSidebar.less");
</style>
